package com.xbongbong.workflow.domain.entity;

import com.alibaba.fastjson.JSONArray;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * @author: 汪腾伟
 * @date: Created in 2022/9/13 17:32
 * @description： 工作流修改记录实体
 *
 * tb_workflow_data_change_record
 */
@Getter
@Setter
public class WorkflowDataChangeRecordEntity implements Serializable {

    private static final long serialVersionUID = -290242001344372750L;

    private Long id;

    private String corpid;

    private Long formId;

    private Integer saasMark;

    private Integer businessType;

    /**
     * 审批任务id,tb_workflow_task主键id
     */
    private Long workflowTaskId;

    /**
     * 审批节点id,tb_workflow_task_node主键id
     */
    private Long workflowTaskNodeId;

    /**
     * 数据id
     */
    private Long dataId;

    /**
     * 存储日志记录，格式  [
     *         {
     *             "attr": "text_1",
     *             "subForm_tag": false,
     *             "value": {
     *                 "beforeValue": "123",
     *                 "afterValue": "345",
     *
     *             },
     *             "operateTag": 1 // 0 无操作，1：新增  2：删除 3：修改  ，返回0的时候前端就把查看日志的入口关掉
     *         },
     *         {
     *             "attr": "subForm_1",
     *             "subForm_tag": true,
     *             "content": [
     *                 {
     *                     "operateTag": 1,
     *                     "rowInfo": [
     *                         {
     *                             "attr": "text_1",
     *                             "value": {
     *                                 "beforeValue": "123",
     *                                 "afterValue": "345"
     *                             },
     *                         }
     *                     ]
     *                 }
     *             ]
     *         }
     *     ]
     */
    private JSONArray data;

    /**
     * 创建人id(每次对审批信息进行修改的人)
     */
    private String creatorId;

    /**
     * 创建时间
     */
    private Long addTime;
    /**
     * 更新时间时间戳
     */
    private Long updateTime;

    public WorkflowDataChangeRecordEntity() {
    }

    public WorkflowDataChangeRecordEntity(String corpid, Long formId, Integer saasMark, Integer businessType, Long workflowTaskId, Long workflowTaskNodeId, Long dataId, JSONArray data, String creatorId, Long addTime, Long updateTime) {
        this.corpid = corpid;
        this.formId = formId;
        this.saasMark = saasMark;
        this.businessType = businessType;
        this.workflowTaskId = workflowTaskId;
        this.workflowTaskNodeId = workflowTaskNodeId;
        this.dataId = dataId;
        this.data = data;
        this.creatorId = creatorId;
        this.addTime = addTime;
        this.updateTime = updateTime;
    }

    public WorkflowDataChangeRecordEntity(Long id, String corpid, Long formId, Integer saasMark, Integer businessType, Long workflowTaskId, Long workflowTaskNodeId, Long dataId, JSONArray data, String creatorId, Long addTime, Long updateTime) {
        this.id = id;
        this.corpid = corpid;
        this.formId = formId;
        this.saasMark = saasMark;
        this.businessType = businessType;
        this.workflowTaskId = workflowTaskId;
        this.workflowTaskNodeId = workflowTaskNodeId;
        this.dataId = dataId;
        this.data = data;
        this.creatorId = creatorId;
        this.addTime = addTime;
        this.updateTime = updateTime;
    }
}
